
#pragma once

#include "BasicPipeline.h"
#include "SubPipeline.h"

namespace ttg_internal
{
	namespace utils
	{
		///<summary>
		/// Wrapper-class, that provides references to corresponded parameters.
		///</summary>
		public ref class Pipeline :public BasicPipeline
		{
			private:
				System::Collections::ObjectModel::ObservableCollection<SubPipeline ^> ^_subPipelines;
			internal:
				///<summary>
				/// Creates pipeline with required name, nodes and sub-pipelines.
				///</summary>
				Pipeline(ttg_internal::pipeline::LitePipelineInfo &pipeline)
					:BasicPipeline(pipeline.getName(), pipeline.getNodes())
				{
					try
					{
						_subPipelines
							= gcnew System::Collections::ObjectModel::ObservableCollection<SubPipeline ^>();
						for (size_t i = 0; i < pipeline.getSubPipelines().size(); i++)
							_subPipelines->Add(gcnew SubPipeline(pipeline.getSubPipelines()[i]));
					}
					catch (System::Exception ^ex)
					{
						throw gcnew System::ApplicationException("Cannot deserialize pipeline", ex);
					}
				}
			public:
				///<summary>
				/// Returns used sub-pipelines.
				///<summary>
				property System::Collections::ObjectModel::ObservableCollection<SubPipeline ^> ^SubPipelines
				{
					System::Collections::ObjectModel::ObservableCollection<SubPipeline ^> ^get()
					{ return _subPipelines; }
				}
		};
	}
}
